<?php


namespace App\Tool;


class Enum
{

    /**
     * 判断值是否在限定的范围内
     * Create by PeterYang
     * 2020/06/02 21:55:42
     * Email:904801074@qq.com
     * @param $value
     * @param array $range
     * @return mixed
     * @throws \Exception
     */
    static function range($value,array $range){

        if(!in_array($value,$range)) throw new \Exception('not in range');

        return $value;

    }

}
